#pragma once

template<class Iterator, class Ref, class Ptr>
class Reverse_Iterator
{
	typedef Reverse_Iterator<Iterator, Ref, Ptr> self;
public:
	Reverse_Iterator(Iterator it)
		:_it(it)
	{}

	Ref operator*()
	{
		Iterator tmp = _it;
		return *(--tmp);
	}
	Ptr operator->()
	{
		return &operator*();
	}

	bool operator!=(const self& it) const
	{
		return _it != it._it;
	}

	bool operator==(const self& it) const
	{
		return _it == it._it;
	}
	self operator++()
	{
		--_it;
		return *this;
	}

	self operator--()
	{
		++_it;
		return *this;
	}
private:
	Iterator _it;
};